package com.luych.toolbox.common.feign.intf.docker.service;

import com.luych.toolbox.common.constant.PageConstant;
import com.luych.toolbox.common.feign.param.docker.service.DockerImageParam;
import com.luych.toolbox.common.feign.view.docker.service.DockerImageView;
import com.luych.toolbox.common.page.CommonPageResult;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(contextId = "docker-service-docker-image", name = "docker-image", path = "/image", decode404 = true)
public interface DockerImageFeign {

    @ApiOperation("按关键字查询")
    @GetMapping("/page")
    CommonPageResult<DockerImageView> page(
            @ApiParam(value = "每页容量") @RequestHeader(name = "pageSize", required = false, defaultValue = PageConstant.DEFAULT_PAGE_SIZE_STR) long pageSize,
            @ApiParam(value = "查询页码") @RequestHeader(name = "pageNumber", required = false, defaultValue = PageConstant.DEFAULT_PAGE_NUMBER_STR) long pageNumber,
            @ApiParam(value = "排序字段") @RequestHeader(name = "sort", required = false, defaultValue = PageConstant.DEFAULT_PAGE_SORT) String sort,
            @ApiParam(value = "正序/倒序，取值ASC/DESC") @RequestHeader(name = "order", required = false, defaultValue = PageConstant.DEFAULT_PAGE_ORDER) String order,
            @ApiParam(value = "宿主机ID") @RequestParam("serverId") String serverId,
            @ApiParam(value = "查询关键字") @RequestParam(name = "keyword", required = false) String keyword);

    @ApiOperation("新增")
    @PostMapping(value = "/create")
    void create(@ApiParam(value = "宿主机ID") @RequestParam("serverId") String serverId,
                @ApiParam(value = "数据信息") @RequestBody DockerImageParam model
    );

    @ApiOperation("删除")
    @DeleteMapping("/remove")
    void remove(@ApiParam(value = "宿主机ID") @RequestParam("serverId") String serverId,
                @ApiParam(value = "ID") @RequestParam(value = "id") String id
    );

    @ApiOperation("详情")
    @GetMapping("/detail")
    DockerImageView get(@ApiParam(value = "宿主机ID") @RequestParam("serverId") String serverId,
                        @ApiParam(value = "ID") @RequestParam(value = "id") String id
    );

    @ApiOperation("推送")
    @PostMapping("/push")
    void push(@ApiParam(value = "宿主机ID") @RequestParam("serverId") String serverId,
              @ApiParam(value = "ID") @RequestParam(value = "id") String id
    );

}
